<?php
namespace Qy\Model;
use Think\Model;

class UserModel extends Model {

    public $_validate = array(
        array('user_id', 'number', '用户ID不能为空', self::MUST_VALIDATE,'', self::MODEL_UPDATE),
        
        array('user_name','require','用户名不能为空', self::MUST_VALIDATE,'',self::MODEL_INSERT),
        array('real_name','require','真实姓名不能为空', self::MUST_VALIDATE,'',self::MODEL_UPDATE),
        array('position','require','职位不能为空', self::MUST_VALIDATE,'',self::MODEL_UPDATE),
        
        array('phone','require','账号码不能为空',self::MUST_VALIDATE,'',self::MODEL_INSERT),
        array('phone','/^1[3|4|5|7|8][0-9]{9}$/','您的账号码格式有误！',self::MUST_VALIDATE,'regex',3),    ///^1(3[0-9]|4[57]|5[0-35-9]|7[01678]|8[0-9])\\d{8}$/
        array('phone','number','账号码已经存在！', 0,'unique',1),
        
        array('password', 'require','密码不能为空',self::MUST_VALIDATE,'',self::MODEL_INSERT),
        array('password', '/^[\S]{6,12}$/', '密码长度要求6-12位，不限制类型', self::EXISTS_VALIDATE)
        
    );
    
    public $_auto = array(
        array('create_time', 'format_time', self::MODEL_INSERT, 'function'),
        array('update_time', 'format_time', self::MODEL_UPDATE, 'function'),
    );
}